﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace KINLO.UI.Main.Converter
{
    public class IsGoodsConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                if (value is null)
                {
                    return "";
                }
                int count;
                if (int.TryParse(value.ToString(), out count))
                {
                    switch (count)
                    {
                        case 1:
                            return "偏大";
                        case 2:
                            return "偏小";
                        case 3:
                            return "多液";
                        case 4:
                            return "少液";
                        case 5:
                            return "未注液";
                        case 6:
                            return "未找到";
                        case 7:
                            return "没电池";
                        case 100:
                            return "合格";
                        default:
                            return "";
                    }
                }else
                {
                    return "";
                }
               
            }
            catch (Exception ex)
            {
                Console.WriteLine("IsGoodsConverter:{0}", ex);
                throw ex;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
